package org.example.jwtdemo.config;

import cn.coderxiaoc.dto.NotificationMessage;
import cn.coderxiaoc.handler.AbstractMessageHandler;
import org.springframework.stereotype.Component;

import java.util.Scanner;

@Component
public class xianyuConfig extends AbstractMessageHandler {

        @Override
    public void onMessage(NotificationMessage message) {
        System.out.println("收到消息"+message.getReminderContent());
        while (true) {
            Scanner scanner = new Scanner(System.in);
            String input = scanner.nextLine();
            this.xianyuMain.sendMsg(message.getCid(), message.getSenderUserId(), input);
        }
    }

    @Override
    public void userInput(String userId) {
        System.out.println("用户输入"+userId);
    }

    @Override
    public void userPay(NotificationMessage message) {
        System.out.println("用户付款"+message.getReminderContent());
    }

    @Override
    public void userUnPay(NotificationMessage message) {
        System.out.println("用户退款"+message.getReminderContent());
    }

    @Override
    public void userCloseTransaction(NotificationMessage message) {
        System.out.println("用户关闭交易"+message.getReminderContent());
    }

    @Override
    public void obligation(NotificationMessage message) {
        System.out.println("待支付中");
    }

    @Override
    public void remindOfShipment(NotificationMessage message) {
        System.out.println("提醒发货"+ message.getReminderContent());
    }

    @Override
    public void defaultMessage(String message) {
        System.out.println("默认消息"+message);
    }

    @Override
    public void myUserMessage(NotificationMessage message) {

    }

    @Override
    public void allMessage(String message) {
//        System.out.println("默认消息"+message);
    }
}
